<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>在线图书阅读管理平台</title>
    <script src="js/jquery.js"></script>
    <script src="js/jquery-3.6.0.js"></script>
    <link href="css/font-awesome.css" rel="stylesheet">
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet">
    <link href="css/default-theme.css" rel="stylesheet">
    <link href="css/style1.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">
    <link href="css/datatables.min.css" rel="stylesheet">
</head>
<body class="sticky-header" style="font-weight: normal">
<section>
    <div class="sidebar-left">
        <div class="sidebar-left-info">
            <div class=" search-field"> </div>
            <ul class="nav nav-pills nav-stacked side-navigation">
                <li class="menu-list nav-active"> <a href=""><i class="fa fa-user-circle"></i> <span>用户管理</span></a>
                    <ul class="child-list">
                        <li class="active"><a href="manager.jsp">用户列表</a></li>
                    </ul>
                </li>
                <li class="menu-list"> <a href=""><i class="fa fa-pencil-square-o"></i> <span>作者管理</span></a>
                    <ul class="child-list">
                        <li><a href="author.jsp">作者列表</a></li>
                        <li><a href="examine.jsp">作者审核</a></li>
                    </ul>
                </li>
                <li class="menu-list"> <a href=""><i class="fa fa-paper-plane-o"></i><span>图书管理</span></a>
                    <ul class="child-list">
                        <li><a href="bookList.jsp">图书列表</a></li>
                        <li><a href="bookExamine.jsp">图书审核</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="body-content">
        <div class="header-section">
            <div class="logo dark-logo-bg"> <a href="manager.jsp">
                <span class="brand-name" style="font-size: 15px; font-weight: bold;"><img src="images/book-2.png" alt="">在线图书阅读管理平台</span> </a> </div>
            <div class="icon-logo dark-logo-bg hidden-xs hidden-sm"> <a href="manager.jsp"><img src="images/book-2.png" alt=""> </a> </div>
            <a class="toggle-btn"><i class="fa fa-align-justify" style="font-size:20px"></i></a>
            <div class="kouhao"></div>
            <div class="notification-wrap">
                <div class="right-notification">
                    <ul class="notification-menu">
                        <li> <a href="javascript:;" class="btn btn-default  dropdown-toggle"> <img src="images/sousuo.png">搜索</a> </li>
                        <li> <a href="javascript:;" class="btn btn-default  dropdown-toggle"> <img src="images/tongzhi.png">通知</a> </li>
                        <li> <a href="javascript:;" class="btn btn-default  dropdown-toggle"><img src="images/yonghu.png">退出登录<i class="fa fa-arrow-circle-o-right"></i></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="page-head">
            <ol class="breadcrumb" style="display: block;margin-top: 5px">
                <li><a style="color:#333" class="font">图书管理</a></li>
                <li class="active"><a href="#" class="font">图书审核</a></li>
            </ol>
            <h3>图书审核</h3>
        </div>
        <div class="wrapper">
            <div class="panel">
                <div class="panel-body">
                    <div class="row" style="margin-bottom: 20px">
                        <div class="form1 searchbox">
                            <ul class="row">
                                <li class="col-sm-3"></li>
                                <li class="col-sm-3"></li>
                                <li class="col-sm-4"> <span></span><input type="text" class="form-control" id="searchInput" placeholder="请输入用户信息"></li>
                                <li class="col-xs-2" style="padding-left: 0"> <a href="#" class="btn btn-primary">查询</a></li>
                            </ul>
                        </div>
                    </div>
                    <table id="default-datatable" data-plugin="DataTable"
                           class="table table-striped table-hover table-condensed" cellspacing="0" width="100%">
                        <thead id="header">
                        <tr>
                            <th style="width: 160px" class="text-center">序号</th>
                            <th style="width: 160px" class="text-center">书名</th>
                            <th style="width: 160px" class="text-center">作者</th>
                            <th style="width: 100px" class="text-center">标签</th>
                            <th style="width: 160px" class="text-center">封面</th>
                            <th style="width: 160px" class="text-center">简介</th>
                            <th style="width: 160px" class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody id="table-body">
                        </tbody>
                    </table>
                    <div class="row">
                        <div class="col-sm-5"></div>
                        <div class="col-sm-7">
                            <div class="text-right">
                                <ul class="pagination">

                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="deleteModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="deleteModalLabel1">确认删除</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                确认是否删除该用户？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-danger"  data-dismiss="modal" id="deleteInfo">删除</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal1" tabindex="-1" aria-labelledby="editModalLabel">
    <div class="modal-dialog" style="width: 500px;">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title" id="deleteModalLabel">编辑用户信息</h3>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form id="editForm">
                    <div class="form-group">
                        <label for="userid">序号:</label>
                        <input type="text" class="form-control" id="userid" name="userid">
                    </div>
                    <div class="form-group">
                        <label for="username">用户名:</label>
                        <input type="text" class="form-control" id="username" name="username">
                    </div>
                    <div class="form-group">
                        <label for="password">密码:</label>
                        <input type="text" class="form-control" id="password" name="password">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-secondary update" data-dismiss="modal" id="revise">确定</button>
            </div>
        </div>
    </div>
</div>
<script>
$(document).ready(function (){
    inin(1);
})

    function inin(page) {
        $.ajax({
            type:"Get",
            url:'/examine/getApplyBook?page='+page+'&rows=5',
            dataType:"json",
            success:function (data){
                for (var i=0;i<data.list.length;i++){
                    $('#table-body').html('<tr><td class="text-center">' + data.list[i].id + '</td><td class="text-center">' + data.list[i].bookName +
                        '</td><td class="text-center">' + data.list[i].author + '</td><td class="text-center">' +data.list[i].mainsignature+'</td><td class="text-center" style="height: 20px">'+
                        '<img src="'+data.list[i].bookImage+'" id="im"></td><td class="text-center">'+data.list[i].profile+'</td><td class="text-center">'+
                        '<a href="#" data-toggle="modal" data-target="#myModal" class="btn btn-primary btn-sm" id="confirm">审核</a></td></tr>');
                }
                var li='<li class="page-item"><a class="page-link" href="#" onclick="inin(1)">&laquo;</a></li>';
                for(var i=1;i<=data.totalPages;i++) {
                    if(i==page){
                        li+='<li class="page-item active"><a class="page-link" href="#" onclick="inin('+i+')">'+i+'</a></li>'
                    }else{
                        li+='<li class="page-item"><a class="page-link" href="#" onclick="inin('+i+')">'+i+'</a></li>'
                    }
                };
                li+='<li class="page-item"><a class="page-link" href="#" onclick="inin('+data.totalPages+')">&raquo;</a></li>';
                $(".pagination").html(li);
            }
        })
    }
</script>
</body>
</html>